import 'package:flutter/material.dart';

class EgTableView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("Table view的演示"),
      ),
      body: new Center(
        child: new Table(
          columnWidths: const <int, TableColumnWidth>{
            0: FixedColumnWidth(100),
            1: FixedColumnWidth(100),
            2: FixedColumnWidth(100),
            3: FixedColumnWidth(100)
          },
          border: TableBorder.all(color: Colors.black38, width: 2.0, style: BorderStyle.solid),
          children: const <TableRow>[
            TableRow(children: <Widget>[
              Text(
                "姓名",
                style: TextStyle(fontSize: 20),
              ),
              Text(
                "性别",
                style: TextStyle(fontSize: 20),
              ),
              Text(
                "年龄",
                style: TextStyle(fontSize: 20),
              ),
              Text(
                "身高",
                style: TextStyle(fontSize: 20),
              ),
            ]),
            TableRow(children: <Widget>[
              Text("张三"),
              Text("男"),
              Text("28"),
              Text("170"),
            ]),
            TableRow(children: <Widget>[
              Text("李四"),
              Text("女"),
              Text("12"),
              Text("178"),
            ])
          ],
          defaultVerticalAlignment: TableCellVerticalAlignment.middle,
        ),
      ),
    );
  }
}
